package com.itheima.test0909.test04;

public class IntegerTest_pro {
    public static void main(String[] args) {
        String s = "张三,98,99,100";
        String s1 = "";
        s = s.trim();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == ',' || (s.charAt(i) >= '0' &&  s.charAt(i) <= '9')){
                s1 = s1 + s.charAt(i);
            }
        }
        System.out.println(s1);
        int sum = 0;
        String[] split = s1.split(",");
        for (int i = 0; i < split.length; i++) {
            if (!"".equals(split[i])){
                sum += Integer.valueOf(split[i]);
            }
        }
        System.out.println("数组内数字求和为" + sum);
    }
}
